const apiBaseUrl = 'https://api.xunyi.mobi/api/v1'
function authRequest({url, data, method, dataType, header, success, fail, complete}) {
  const accessToken = wx.getStorageSync('ak');
  const authString = 'Bearer ' + accessToken;
  const commonHeader = {
    'Accept': 'application/json',
    'Authorization': authString
  };
 
  const requestHeader = Object.assign(commonHeader, header ? header : {});
  wx.request({
    url: `${apiBaseUrl+url}`,
    data,
    method,
    dataType,
    header: requestHeader,
    success,
    fail,
    complete
  })
};
module.exports = {
  authRequest
};